package com.pdx.shiro.bh;

import org.junit.Test;

/**
 * @author 派 大 星
 * @function 测试
 * @date 2022/4/5 18:22
 * @website https://blog.csdn.net/Gaowumao
 */
public class TestEncode {

    @Test
    public void HexTest(){
        java.lang.String val = "hello";
        String s = EncodesUtil.encodeHex(val.getBytes());
        System.out.println("加密后的val =>"+s);
        String str = new String(EncodesUtil.decodeHex(s));
        System.out.println("解密后的val =>"+str);
        System.out.println("比较结果 =>"+val.equals(str));
    }

    @Test
    public void testBase64(){
        String val = "hello";
        String str1 = EncodesUtil.encodeBase64(val.getBytes());
        System.out.println("Base64加密后的val =>"+str1);
        String str2 = new String(EncodesUtil.decodeBase64(str1));
        System.out.println("Base64解密后的val =>"+str2);
        System.out.println("比较结果 =>"+val.equals(str2));
    }
}
